package com.todo.member.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/2/12 11:21
 * @description
 */
@Getter
@AllArgsConstructor
public enum LevelRewardRecordStatusEnum {

    WAIT_DISTRIBUTE(1, "WAIT_DISTRIBUTE", "待发放"),
    DISTRIBUTING(2, "DISTRIBUTING", "发放中"),
    GRANT_SUCCESS(3, "GRANT_SUCCESS", "发放成功"),
    GRANT_FAIL(4, "GRANT_FAIL", "发放失败"),
    RETRY_FAIL(5, "RETRY_FAIL", "重试失败"),
    ;

    private static Map<Integer, LevelRewardRecordStatusEnum> typeMap = Arrays
            .stream(LevelRewardRecordStatusEnum.values())
            .collect(Collectors.toMap(LevelRewardRecordStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static LevelRewardRecordStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
